home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / PaneListBox.h < prev    next >
Text File  |  1997-08-07  |  2KB  |  92 lines

  1. /*
  2.  *    File:        PaneListBox.h
  3.  *    Function:    A pane containing a list of all the Raven panes.
  4.  *    Written by:    Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *    Change History (most recent first):
  10.  *
  11.  *         <->     8/10/96    JDJ        created
  12.  */
  13.  
  14. #pragma once
  15.  
  16. #include <ZDragSource.h>
  17. #include <ZListBox.h>
  18.  
  19.  
  20. // ========================================================================================
  21. //    struct SPaneEntry
  22. // ========================================================================================
  23. struct SPaneEntry {
  24.     string        name;
  25.     TPane*        pane;
  26.     
  27.                     SPaneEntry(const string& str = "")                    {name = str; pane = nil;}
  28.                     
  29.         bool        operator==(const SPaneEntry& rhs) const                {return name == rhs.name;}
  30.  
  31.         bool        operator!=(const SPaneEntry& rhs) const                {return name != rhs.name;}
  32.         
  33.         bool        operator<(const SPaneEntry& rhs) const                {return name < rhs.name;}
  34. };
  35.  
  36.  
  37. __MSL_FIX_ITERATORS__(const SPaneEntry);
  38.  
  39. // ========================================================================================
  40. //    class CPaneListBox
  41. // ========================================================================================
  42. class CPaneListBox : public TListBox<SPaneEntry>, public MDragSource {
  43.  
  44.     typedef    TListBox<SPaneEntry> Inherited;
  45.  
  46. //-----------------------------------
  47. //    Initialization/Destruction
  48. //
  49. public:
  50.     virtual               ~CPaneListBox();
  51.  
  52.                         CPaneListBox(TView* superView);
  53.  
  54. //-----------------------------------
  55. //    TListBox API
  56. //
  57. protected:
  58.     virtual void         Invariant() const;
  59.     
  60.     virtual void         OnReanimated();
  61.     
  62.     virtual bool         OnMouseDown(const TMouseEvent& event);
  63.  
  64.     virtual void        OnDrawCell(TCanvas& canvas, const TRect& cellBounds, const SPaneEntry& entry, bool isSelected);
  65.  
  66. //-----------------------------------
  67. //    MDragSource API
  68. //
  69. protected:
  70.     virtual void         OnAddDragData(TDragSession& session, const TMouseEvent& event);
  71.                         
  72. //-----------------------------------
  73. //    MCommander API
  74. //
  75. public:
  76.     virtual bool         WantsTarget() const;
  77.  
  78. //-----------------------------------
  79. //    TReanimator Support
  80. //
  81. public:
  82.     static     MReanimatable* Create(MReanimatable* parent);
  83.  
  84. //-----------------------------------
  85. //    Member data
  86. //
  87. protected:
  88.     TTextTrait    mTextTraits;
  89. };
  90.  
  91.  
  92.